<template>
  <div class="side-bar" id="side-bar">
    <div class="mod">
      <router-link to="/cart" class="cart item" target="_blank" style="height:100px;line-height: 0px;">
      <div style="line-height: 20px;padding-top:10px">

        <svg-icon icon-class="gouwuche" class-name="gouwuche">gouwc</svg-icon>
         <p style="color:#fff">购<br>物<br>车</p>
      </div>

        <span>购物车
          <b class="J-cartCount">{{cartAmount}}</b>
        </span>
        <!-- <p>添加成功，共
          <em class="J-cartCount"></em>
          种<em class="J-totalNumber"></em>件。
        </p> -->
      </router-link>
      <router-link to="/cart" class="qsxd item" target="_blank">
        <svg-icon icon-class="xiadan" class-name="xiadan" />
        <span>快速下单</span>
        <i></i>
      </router-link>
      <router-link to="/selector" class="slt item" target="_blank">
        <svg-icon icon-class="xuanxing" class-name="xuanxing" />
        <span>专业选型</span>
        <i></i>
    </router-link>

      <a href="https://wpa.qq.com/msgrd?v=3&uin=578898066&site=qq&menu=yes" target="_blank" class="qq item">
        <svg-icon icon-class="QQkefu" class-name="QQkefu" />
        <span>联系客服</span>
        <i></i>
      </a>
      <a href="javascript:;" class="wx item">
        <svg-icon icon-class="weichat" class-name="weichat" />
        <div class="toggle">
          <div class="toggleWxWrap">
            <p>微信客服</p>
            <div class="picWrap">
              <img src="../assets/img/sjqr.jpg" alt="微信客服二维码">
            </div>
          </div>
        </div>
      </a>
      <div href="javascript:;" class="tel item">
        <svg-icon icon-class="dianhua" class-name="dianhua" />
        <span>400-618-0107</span>
        <i></i>
      </div>
    </div>
    <div class="mod-side-bar-bottom">
      <a class="backtop" href="javascript:;" style="display: none;">
        <i class="icon-top"></i>
        <span>返回顶部</span>
        <i></i>
      </a>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'sideBar',
  computed: {
    ...mapGetters(['cartAmount'])
  }
}
</script>

<style lang="scss" scoped>
.side-bar {
  position: fixed;
  right: 0;
  top: 0;
  z-index: 102;
  height: 100%;
  .mod {
    position: absolute;
    bottom: 30%;
    right: 0;
    width: 45px;
    .item {
      position: relative;
      width: 45px;
      height: 70px;
      line-height: 70px;
      *height: 26px;
      display: block;
      box-sizing: border-box;
      text-align: center;
      background: #ff0000;
      .svg-icon {
        position: relative;
        display: inline-block;
        line-height: 36px;
        margin: 0 auto;
        font-size: 20px;
        color: #fff;
        background-position: 0 -116px;
        z-index: 2;
      }
    }
    .cart {
      background: #333;
      span {
        height: 36px;
        line-height: 36px;
        background: #4448f8;
        left: 0px;
        top: 0;
        position: absolute;
        padding: 0;
        width: 0;
        border-radius: 3px 0 0 3px;
        text-align: center;
        overflow: hidden;
        color: #fff;
      }
      p {
        -webkit-transition: linear .2s;
        -o-transition: linear .2s;
        transition: linear .2s;
      }
    }
    .cart:hover {
      background: #4448f8;
      color: #fff;
    }
    .item span {
      height: 36px;
      line-height: 36px;
      background: #4448f8;
      left: 0px;
      top: 0;
      position: absolute;
      padding: 0;
      width: 0;
      border-radius: 3px 0 0 3px;
      text-align: center;
      overflow: hidden;
      color: #fff;
    }
    .item:hover span {
      left: auto;
      left: -97px;
      width: 100px;
      transform: translate(0,0);
      transition:all .2s ease-in 0s;
    }
    .qsxd {
      background: #ff0000;
    }
    .slt {
      background: #4448f8;
    }
    .qq {
      background: #ff0000;
    }
    .wx {
      background: #09bb07;
      .toggle {
        width: 220px;
      }
      .toggle {
        width: 136px;
        height: 36px;
        line-height: 36px;
        background: #4448f8;
        left: 0px;
        top: 0;
        position: absolute;
        padding: 0;
        border-radius: 3px 0 0 3px;
        text-align: center;
        color: #fff;
        -webkit-transition: linear .2s;
        -o-transition: linear .2s;
        transition: linear .2s;
        z-index: 0;
        box-sizing: border-box;
        visibility: hidden;
        .toggleWxWrap {
          position: relative;
          height: 36px;
          visibility: hidden;
          p {
            transition: linear .2s;
          }
          .picWrap {
            height: 0;
            position: absolute;
            top: 100%;
            left: 14px;
            border-width: 0 1px 1px 1px;
            border-style: solid;
            border-color: #c6e9c5;
            background: #fff;
            box-sizing: border-box;
            overflow: hidden;
            img {
              margin-top: 4px;
              width: 192px;
              height: 192px;
            }
          }
        }
      }
    }
    .wx:hover .toggle{
      background: none;
      left: auto;
      width: 220px;
      transform: translate3d(-100%,0,0);
      visibility: visible;
      .toggleWxWrap {
        visibility: visible;
        position: relative;
        height: 36px;
        p {
          width: 100%;
          border-radius: 3px 0 0 3px;
          background: #09bb07;
        }
        .picWrap {
          height: 200px;
          transition: ease-in-out .25s .15s;
        }
      }
    }
    .tel {
      background: #4448f8;
    }
  }
  .mod-side-bar-bottom {
    position: absolute;
    right: 0;
    bottom: 36px;
    width: 36px;
  }
}
</style>
